<template>
	<view class="parent">
		<Meettingdetails  :meetingId="meetingId" class="Meettingdetails" :style="'height:'+this.height*0.5+'px'" />
		<view v-if="isDetails" class="sbumit"  >
			<button type="default" @click="submit(1)">同意方案</button>
			<button type="default"  @click="submit(0)">驳回方案</button>
		</view>
	</view>
</template>

<script>
	import {
		judgeMeeting
	} from '../../api/api_voluntee.js'
	import meettingdetails from './meettingdetails.vue'
	export default {
		data() {
			return {
				title: "详情",
				height:0,
				meetingId:'',
				isDetails:false,//默认是详情
			}
		},
		components: {
			Meettingdetails: meettingdetails,
		},
		methods: {
			submit(ispass){
				uni.showModal({
					title:'提示',
					content:'是否确定',
					success: (res) => {
						if(res.confirm){
							judgeMeeting({
								check: ispass,
								meetId:this.meetingId
							}).then(()=>{
								uni.navigateBack()
								setTimeout(uni.showToast({
									title:'审批成功',
									duration:2000
								}), 200)
							})
						}
					}
				})
			}
		},
		onLoad(ars) {
			this.meetingId = Number.parseInt(ars.meetingId)
			this.isDetails = ars.isDetails==="true"
			console.log(ars)
		},onReady() {
			this.height=uni.getSystemInfoSync().windowHeight;
		}
	}
</script>

<style lang="scss" scoped>

	/**
	 * 定义按钮样式
	 */
	@mixin button-commit {
		background: linear-gradient(180deg, #ff5e59, #e20909);
		color: #fff;
		margin:0 auto 2% auto;
		width: 90%;
	}
	.parent{
		.sbumit{
			@include button-commit;
			    position: absolute;
			    bottom: 0;
			    margin-left: 5%;
			    width: 90%;
		}
	}
</style>
